/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package iterators;

/**
 *
 * @author Jeremy
 */

import java.util.*;
import IA.*;

public class ReverseCompletedServiceIterator implements Iterator<Service> {
    private ArrayList<Service> list;
    private int NextIndex;
    
    public ReverseCompletedServiceIterator(ArrayList<Service> list) {
        this.list = (ArrayList<Service>)list.clone();
        NextIndex = this.list.size() - 1;
    }
    
    @Override
    public boolean hasNext() {
        return NextIndex >= 0;
    }

    @Override
    public Service next() {
        return list.get(NextIndex--);
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
}
